package zhr.chapter8;

public class Calc<T extends Number> {
    private T[] a;

    public Calc(T[] a) {
        this.a = a;
    }

    public double sum() {
        double sum = 0;
        for (T n : a) {
            sum += n.doubleValue();
        }
        return sum;
    }

    public double average() {
        return sum() / a.length;
    }
}
